<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        const h = [{ name: '张三', salary: 1000 },
        { name: '李四', salary: 1000 },
        { name: '好好', salary: 1000 }]
        // 计算他们薪资总和
        // const total = h.reduce((prev, current) => {
        //     return prev + current.salary
        // }, 0)//如果是数组对象里的数据，必须得要有初始值0
        // console.log(total);

        // 需求 涨薪30%
        const total = h.reduce((prev, current) => {
            return prev + current.salary * 1.3
        }, 0)
        console.log(total);
    </script>
</body>

</html>